# Process the data of texas wind farms from tx_locater.pdf

BEGIN {
  FS = "\n"
  RS = ""
  OFS = ","
  ORS = "\n"
  
}

{
  gsub(/,/,";")
  i = 1
  while (i <= NF) {
    
    if ($i ~ /County/) {
      # Get rid of the county index number
      if (i != 1) {
      split($i,x,".")
      $i = x[2]
      }
      print $i "," $(i+1) "," $(i+2)"," $(i+3)"," $(i+4)"," $(i+5)"," $(i+6)"," $(i+7)
      i = i+8
    }
    else {
      print " " "," $i "," $(i+1) "," $(i+2) "," $(i+3)"," $(i+4)"," $(i+5)"," $(i+6)
      i = i+7
    }
  }
}
